// Licensed to Elasticsearch B.V under one or more agreements.
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information.
//
// ███╗   ██╗ ██████╗ ████████╗██╗ ██████╗███████╗
// ████╗  ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝
// ██╔██╗ ██║██║   ██║   ██║   ██║██║     █████╗
// ██║╚██╗██║██║   ██║   ██║   ██║██║     ██╔══╝
// ██║ ╚████║╚██████╔╝   ██║   ██║╚██████╗███████╗
// ╚═╝  ╚═══╝ ╚═════╝    ╚═╝   ╚═╝ ╚═════╝╚══════╝
// ------------------------------------------------
//
// This file is automatically generated.
// Please do not edit these files manually.
//
// ------------------------------------------------

#nullable restore

using System;
using System.Linq;
using Elastic.Clients.Elasticsearch.Serialization;

namespace Elastic.Clients.Elasticsearch.Core.RankEval;

[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.RankEval.Json.RankEvalMetricConverter))]
public sealed partial class RankEvalMetric
{
#if NET7_0_OR_GREATER
	public RankEvalMetric()
	{
	}
#endif
#if !NET7_0_OR_GREATER
	public RankEvalMetric()
	{
	}
#endif
	[System.Diagnostics.CodeAnalysis.SetsRequiredMembers]
	internal RankEvalMetric(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel)
	{
		_ = sentinel;
	}

	public Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricDiscountedCumulativeGain? Dcg { get; set; }
	public Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricExpectedReciprocalRank? ExpectedReciprocalRank { get; set; }
	public Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricMeanReciprocalRank? MeanReciprocalRank { get; set; }
	public Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricPrecision? Precision { get; set; }
	public Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricRecall? Recall { get; set; }
}

public readonly partial struct RankEvalMetricDescriptor
{
	internal Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetric Instance { get; init; }

	[System.Diagnostics.CodeAnalysis.SetsRequiredMembers]
	public RankEvalMetricDescriptor(Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetric instance)
	{
		Instance = instance;
	}

	[System.Diagnostics.CodeAnalysis.SetsRequiredMembers]
	public RankEvalMetricDescriptor()
	{
		Instance = new Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetric(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance);
	}

	public static explicit operator Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricDescriptor(Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetric instance) => new Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricDescriptor(instance);
	public static implicit operator Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetric(Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricDescriptor descriptor) => descriptor.Instance;

	public Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricDescriptor Dcg(Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricDiscountedCumulativeGain? value)
	{
		Instance.Dcg = value;
		return this;
	}

	public Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricDescriptor Dcg()
	{
		Instance.Dcg = Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricDiscountedCumulativeGainDescriptor.Build(null);
		return this;
	}

	public Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricDescriptor Dcg(System.Action<Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricDiscountedCumulativeGainDescriptor>? action)
	{
		Instance.Dcg = Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricDiscountedCumulativeGainDescriptor.Build(action);
		return this;
	}

	public Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricDescriptor ExpectedReciprocalRank(Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricExpectedReciprocalRank? value)
	{
		Instance.ExpectedReciprocalRank = value;
		return this;
	}

	public Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricDescriptor ExpectedReciprocalRank(System.Action<Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricExpectedReciprocalRankDescriptor> action)
	{
		Instance.ExpectedReciprocalRank = Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricExpectedReciprocalRankDescriptor.Build(action);
		return this;
	}

	public Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricDescriptor MeanReciprocalRank(Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricMeanReciprocalRank? value)
	{
		Instance.MeanReciprocalRank = value;
		return this;
	}

	public Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricDescriptor MeanReciprocalRank()
	{
		Instance.MeanReciprocalRank = Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricMeanReciprocalRankDescriptor.Build(null);
		return this;
	}

	public Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricDescriptor MeanReciprocalRank(System.Action<Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricMeanReciprocalRankDescriptor>? action)
	{
		Instance.MeanReciprocalRank = Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricMeanReciprocalRankDescriptor.Build(action);
		return this;
	}

	public Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricDescriptor Precision(Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricPrecision? value)
	{
		Instance.Precision = value;
		return this;
	}

	public Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricDescriptor Precision()
	{
		Instance.Precision = Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricPrecisionDescriptor.Build(null);
		return this;
	}

	public Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricDescriptor Precision(System.Action<Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricPrecisionDescriptor>? action)
	{
		Instance.Precision = Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricPrecisionDescriptor.Build(action);
		return this;
	}

	public Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricDescriptor Recall(Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricRecall? value)
	{
		Instance.Recall = value;
		return this;
	}

	public Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricDescriptor Recall()
	{
		Instance.Recall = Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricRecallDescriptor.Build(null);
		return this;
	}

	public Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricDescriptor Recall(System.Action<Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricRecallDescriptor>? action)
	{
		Instance.Recall = Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricRecallDescriptor.Build(action);
		return this;
	}

	[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
	internal static Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetric Build(System.Action<Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricDescriptor>? action)
	{
		if (action is null)
		{
			return new Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetric(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance);
		}

		var builder = new Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricDescriptor(new Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetric(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance));
		action.Invoke(builder);
		return builder.Instance;
	}
}